<?php
// No direct access
defined('_JEXEC') or die('Restricted access');

// import Joomla table library
jimport('joomla.database.table');

/**
 * Products Table class
 */
class ProductTableProduct extends JTable
{
	/**
	 * Constructor
	 *
	 * @param object Database connector object
	 */
	function __construct(&$db) {
		parent::__construct('#__product', 'id', $db);
	}
	
	/**
	 * Overrides JTable::store to set modified data and user id.
	 *
	 * @param   boolean  $updateNulls  True to update fields even if they are null.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   11.1
	 */
	public function store($updateNulls = false)
	{
		$date = JFactory::getDate();
		$user = JFactory::getUser();

		$date = $date->toSql();
		if (!$this->id) {
			// New product. An product created and created_by field can be set by the user,
			// so we don't touch either of these if they are set.
			$this->created = $date;
		}
		
		// Existing item
		$this->modified = $date;
		
		// $this->modified_by = $user->get('id');

		return parent::store($updateNulls);
	}
}